﻿// Copyright (C) 2013  Patrick Maher

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

using Paragon.Geometry;

namespace Paragon.Math
{
    internal static class PMath
    {
        //public static void Lerp(Ray r, float delta, ref Vector3f coords)
        //{
        //    //coords = r.Direction * delta + r.Origin;
        //    Vector3fMult(r.Direction, delta, ref coords);
            
        //}
        public static void Lerp(Vector3f origin, Vector3f direction, float delta, ref Vector3f coords)
        {
            //coords = direction * delta + origin;
            Vector3fMult(ref direction, delta, ref coords);
            Vector3fAdd(ref coords, ref origin, ref coords);
        }

        public static void Vector3fAdd(ref Vector3f v1, ref Vector3f v2, ref Vector3f v3)
        {
            v3.X = v1.X + v2.X;
            v3.Y = v1.Y + v2.Y;
            v3.Z = v1.Z + v2.Z;
        }
        public static void Vector3fMult(ref Vector3f v1, float s1, ref Vector3f v2)
        {
            v2.X = v1.X * s1;
            v2.Y = v1.Y * s1;
            v2.Z = v1.Z * s1;
        }
        public static void Vector3fMult(ref Vector3f v1, ref Vector3f v2, ref Vector3f v3)
        {
            v3.X = v1.X * v2.X;
            v3.Y = v1.Y * v2.Y;
            v3.Z = v1.Z * v2.Z;
        }
    }
}